import { defHttp } from '@/utils/http/axios';
import { BannerParam, BannerListGetResultModel } from './model/bannerModel';

enum Api {
  BANNER_LIST = '/banner/list',
  BANNER_SAVE = '/banner/save',
  BANNER_UPDATE_STATUS = '/banner/updateStatus',
  BANNER_DELETE = '/banner/del',
}

/**
 * @description: Get sample list value
 */

export const bannerListApi = (params: BannerParam) =>
  defHttp.get<BannerListGetResultModel>({
    url: Api.BANNER_LIST,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const bannerSaveApi = (params: BannerParam) =>
  defHttp.post<number>({
    url: Api.BANNER_SAVE,
    params,
    headers: {
      // @ts-ignore
    },
  });

export const bannerUpdateStatusApi = (params: BannerParam) =>
  defHttp.postForm<number>({
    url: Api.BANNER_UPDATE_STATUS,
    params,
    headers: {
      // @ts-ignore
    },
  });

export const bannerDeleteApi = (params: BannerParam) =>
  defHttp.postForm<number>({
    url: Api.BANNER_DELETE,
    params,
    headers: {
      // @ts-ignore
    },
  });
